#!/bin/sh

export ROOTDIR=${ROOTDIR:="$(pwd)/../../.."}

export APP=$1
export SITE=$2
HOSTS=$3

conf=$(cat $ROOTDIR/opt/site/default/default.conf | sed s/APP/$APP/g)
$ROOTDIR/crosslight.sh site prep $APP
echo "$conf" >| $ROOTDIR/etc/sites/sites.d/${APP}.conf
ln -s "$SITE" "$ROOTDIR/var/sites/$APP"

if [ "{$HOSTS}x" = "-hx" ] ; then
	$ROOTDIR/crosslight.sh site hosts $APP
fi
